home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 22 / Amiga Format AFCD22 (Jan 1998, Issue 106).iso / -in_the_mag- / converters / graphics / netpbm / hpcdtoppm.0.6 / src / adding_code next >
Text File  |  1997-11-16  |  2KB  |  67 lines

  1. Several people were changing the output image format
  2. of the decoder or asked for a different output format.
  3.  
  4. pbmplus enables the transformation to every image
  5. format, but sometimes it is better to have the
  6. format "inside". Therefore v0.5 is able to keep several
  7. format 'drivers'. 
  8.  
  9.  
  10. To add a new output format:
  11.  
  12. - Append a new tag to the enum type OUTFOR in hpcdtoppm.h
  13.  
  14. - change O_DEFAULT to this tag in config.h if you want to
  15.   have this format as the default format.
  16.  
  17. - Insert a new 'if(...){...}' contruct to the procedure
  18.   parseargs in main.c after the comment "Output options".
  19.  
  20. - Insert description text to error.c and hpcdtoppm.man.
  21.  
  22. - If your format needs only grayscale data, append your
  23.   tag to the line "monochrome=(outfor==O_PGM)|| ..."
  24.   in the main procedure in main.c .
  25.  
  26. - If your format uses the paper size values, append your
  27.   tag to the line "paper=(outfor==O_PS)|| ..."
  28.   in the main procedure in main.c .
  29.  
  30. - Insert your tag into the switch-statement in the
  31.   procedure colconvert in color.c. If you need a
  32.   8-bit-grayscale or 24-bit-rgb model, you just
  33.   have to insert a "case O_YourTag :" . Otherwise
  34.   you have to write your own colorconversion.
  35.  
  36. - Insert your tag and procedure name into the switch-
  37.   statement in the procedure writepicture in output.c. 
  38.   If you have a three-plane-image you can use the do_3plane
  39.   procedure with a pointer to your format writing
  40.   procedure as the first argument, if you have one 
  41.   image plane, use the do_1plane. Otherwise write 
  42.   a similar do_nplane  procedure.
  43.  
  44. - Write a procedure, which produces your format. You
  45.   should use the parameter scheme as defined for the
  46.   driver types OUT3PL and OUT1PL in hpcdtoppm.h.
  47.  
  48.   This means:
  49.   - a FILE *pointer to the output file
  50.   - image width and height.
  51.   
  52.   - for each image plane the triple:
  53.     - a pointer to the upper left position
  54.     - a relative row step    ( in bytes )
  55.     - a relative column step ( in bytes )
  56.  
  57. - If it works, let me know it. :-) Send mail to
  58.   danisch@ira.uka.de .   
  59.  
  60.  
  61.  
  62. Hadmut
  63.  
  64.  
  65.  
  66.  
  67.